import instance from './index.js'
import {
	encrypt,
	decrypt
} from '@/utils/crypto'

function encryptFun(data) {
	return {
		parameter: encrypt(data)
	}
}

// 我的
export const userIndex = (body) => {
	return instance({
		url: '/api/user/index',
		method: 'GET',
		params: {
			...encryptFun(body)
		}
	})
}

// 注册
export const userRegister = (body) => {
	return instance({
		url: '/api/user/register',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 短信验证码
export const smsSend = (body) => {
	return instance({
		url: '/api/sms/send',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 邮箱验证码
export const emsSend = (body) => {
	return instance({
		url: '/api/ems/send',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 登录
export const userLogin = (body) => {
	return instance({
		url: '/api/user/login',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}


// 登录2
export const loginTwo = (body) => {
	return instance({
		url: '/api/user/loginTwo',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 交易明细
export const indexRechargeList = (body) => {
	return instance({
		url: '/api/index/recharge_list',
		method: 'GET',
		params: {
			...encryptFun(body)
		}
	})
}

// 提现转账
export const indexWithdrawOrder = (body) => {
	return instance({
		url: '/api/index/withdraw_order',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 提现转账 手续费
export const indexWithdrawFee = (body) => {
	return instance({
		url: '/api/index/withdraw_fee',
		method: 'GET',
		params: {
			...encryptFun(body)
		}
	})
}


// 重置登录密码
export const userResetpwd = (body) => {
	return instance({
		url: '/api/user/resetpwd',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 闪兑配置列表
export const indexExchargeList = (body) => {
	return instance({
		url: '/api/index/excharge_list',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}


// 闪兑金额
export const indexExchargeConvert = (body) => {
	return instance({
		url: '/api/index/excharge_convert',
		method: 'GET',
		params: {
			...encryptFun(body)
		}
	})
}

// 闪兑订单
export const indexExchargeOrder = (body) => {
	return instance({
		url: '/api/index/excharge_order',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 闪兑订单列表
export const indexExchargeOrderList = (body) => {
	return instance({
		url: '/api/index/excharge_orderlist',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 工会信息
export const indexExchargeGuild = (body) => {
	return instance({
		url: '/api/index/excharge_guild',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 登录是否需要二次验证
export const userTwoVerify = (body) => {
	return instance({
		url: '/api/user/two_verify',
		method: 'POST',
		data: {
			...encryptFun(body)
		}
	})
}

// 忘记密码 用户名查询
export const userRpwPrefix = (body) => {
	return instance({
		url: '/api/user/rpwPrefix',
		method: 'GET',
		params: {
			...encryptFun(body)
		}
	})
}


